<?php
require_once 'pages/TMSItemCreationPage.inc';

class TMSTreeItemCreationPage extends TMSItemCreationPage {
	protected function getItem(){
		$dummy = $this->Model->GetDummyItem();
		if ($this->request->id){
			$p = $this->Model->GetItem($this->$this->request->id);
			if ($p)
				$dummy->Parent = $p->Base;
		}
		return new TMSPageItem($dummy,$this);
	}
	
	protected function doSave($data){
		$item = $this->Model->CreateNested($this->request->id,$data);
		if ($item)
			$this->Application()->Redirect($this->service->ItemEditUrl($item));
	}
}